The present invention relates generally to data processing systems, and in particular, methods for correlating instrumentation to class files in an object oriented programming language.
In analyzing and enhancing performance of a data processing system and the applications executing within the data processing system, it is helpful to know which software modules within a data processing system are using system resources. Effective management and enhancement of data processing systems requires knowing how and when various system resources are being used. Performance tools are used to monitor and examine a data processing system to determine resource consumption as various software applications are executing within the data processing system. For example, a performance tool may identify the most frequently executed modules and instructions in a data processing system, or may identify those modules, which allocate the largest amount of memory or perform the most I/O requests. Hardware performance tools may be built into the system or added at a later point in time. Software performance tools also are useful in data processing systems, such as personal computer systems, which typically do not contain many, if any, built-in hardware performance tools.
One known software performance tool is a trace tool. A trace tool may use more than one technique to provide trace information that indicates execution flows for an executing program. One technique keeps track of particular sequences of instructions by logging certain events as they occur, so-called event-based profiling technique. For example, a trace tool may log every entry into, and every exit from, a module, subroutine, method, function, or system component. Alternately, a trace tool may log the requester and the amounts of memory allocated for each memory allocation request. Typically, a time-stamped record is produced for each such event along with a value related to the amount of resources consumed.
In order to improve performance of code generated by various families of computers, it is often necessary to determine where time is being spent by the processor in executing code, such efforts being commonly known in the computer processing arts as locating xe2x80x9chot spots.xe2x80x9d Ideally, one would like to isolate such hot spots at the instruction and/or source line of code level in order to focus attention on areas, which might benefit most from improvements to the code.
Thus, it is at least as important to accurately map the execution path flow between modules as it is to accurately measure the resources consumed by a particular module. If the path flow cannot be accurately mapped, then the consumption of resources attributed to a particular module is also suspect. One way of tracking path flow is by instrumenting calls to individual modules. Class files are instrumented with trace hooks which may be written to a record each time a module (or method) is entered or exited. For example, at each method entry event a entry trace hook is output for that method entry and at each method exit event a trace exit hook is output for that method exit.
A trace hook identifies a software method by major and minor codes unique to that method. Therefore, when instrumenting a method, a file is created that correlates method names to major and minor codes for the method. This file is called the hook definition file (HDF). Each time the instrumention of a class is modified, the existing HDF must be updated or a new file created. The HDF is stored for use in the postprocessing phase.
When a method entry or exit event occurs, the hook for that event is output, along with metric information related to the amount of resources consumed. The hook includes the unique major/minor codes for the instrumented method. In postprocessing phase, the amount of resources consumed by each method, or other software module, may be calculated from the trace output and a detailed profiling information record may be generated. The profiling information record identifies each method by unique major and minor code which is obtained from the hook. The record is far more usable if the major and minor codes are replaced by the corresponding method name. Therefore, the current version of the HDF is found and merged with the profiling information record.
Methods may be misidentified or left unnamed if the current version of the HDF is not used for merging with the report. Also, because the HDF is a separated file and not physically associated with any class, the HDF may become lost, necessitating the user generate a new HDF version prior to analyzing the profiling information report.
Consequently, it would be desirable to have a system and method for providing correlation information between class files and instrumentation. It would be desirable to have a system and method which would associate that information with the class file from which it was created.
A class file is instrumented with hooks. Each hook is injected in a method at a critical point in the code for tracking path flow, such as where the method will be entered or exited. Each hook includes an identifier to identify the method in which it is injected. Rather than using the method""s name, hooks use unique major and minor codes to identify the method. Static initializers are declared for the class to output other hooks identifying the methods being instrumented. When a class is loaded, the static initializers are executed and hooks identifying the method name and the major and minor codes for each instrumented method are output to, for instance, a trace record. Then, when a method is entered or exited, the hooks identifying the entry or exit are also outputted to a trace record. When postprocessing the trace records, class and instrumentation correlation information is available for merging from trace records in the trace stream.